package com.li.views;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;


/**
 * ImageView从屏幕中消失时，去掉drawable引用，加快内存回收
 * Created by Li on 2016/8/16.
 */
public class RecycleImageView extends ImageView {
    public RecycleImageView(Context context) {
        this(context, null);
    }

    public RecycleImageView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public RecycleImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        setImageDrawable(null);
    }
}
